<template>
	<div>
		<!-- 订单审核-收费订单审核 -->
		<div class="orders_refund_check">
			<!-- 课程、商品订单 -->
			<div v-show="ordertype==1||ordertype==2">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</div>
					<div class="txtbox">
						<span class="label">退款时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">收款人：</span>
						<span class="value">{{studentInfo.payeeName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">收款人电话：</span>
						<span class="value">{{studentInfo.payeeTel}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">退款详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="200"
								prop="p_orderNo"
								label="订单号">
								</el-table-column>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="150"
								prop="p_orderName"
								label="课程/商品/订金">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)"
										>￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_unit"
								label="单位">
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)"
										>￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="优惠金额">
									<template slot-scope="scope">
										<span v-show="scope.row.p_discountMoney===0||(scope.row.p_discountMoney)"
										>￥{{scope.row.p_discountMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_discountName"
								label="优惠名称">
								</el-table-column>
								<!-- <el-table-column
								align="center"
								label="订金扣减">
									<template slot-scope="scope">
										<span v-show="scope.row.p_depositDiscountMoney===0||(scope.row.p_depositDiscountMoney)"
										>￥{{scope.row.p_depositDiscountMoney}}</span>
									</template>
								</el-table-column> -->
								<el-table-column
								align="center"
								prop="p_payModeName"
								label="支付方式">
								</el-table-column>
								<el-table-column
								align="center"
								label="实际支付">
									<template slot-scope="scope">
										<span v-show="scope.row.p_realPayMoney===0||(scope.row.p_realPayMoney)"
										>￥{{scope.row.p_realPayMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_refundNumber"
								label="退费数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="应退费">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldRefundMoney===0||(scope.row.p_shouldRefundMoney)"
										>￥{{scope.row.p_shouldRefundMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								v-if="ordertype==1"
								label="实际退费">
									<template slot-scope="scope">
										<span v-show="scope.row.p_realRefundMoney===0||(scope.row.p_realRefundMoney)"
										>￥{{scope.row.p_realRefundMoney}}</span>
									</template>
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" style="margin-top: 0.1rem;">
						<!-- <div class="item primary" v-if="false">
							<span class="label">总计：</span>
							<span class="value">￥{{tableStatistics.totalMoney}}</span>
						</div> -->
						<div class="item deposit" v-if="tableStatistics.earnestMoney>0">
							<span class="label">订金扣减：</span>
							<span class="value" style="width: 1.73rem;">￥{{tableStatistics.earnestMoney}}</span>
						</div>
						<div class="item actual" v-show="!showAlterMoney" style="margin-top:0.1rem;">
							<span class="label">实际退款：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
							<i class="el-icon-edit editBtn" @click="alterMoney"></i>
						</div>
						<div class="item actual" v-show="showAlterMoney" style="margin-top:0.1rem;">
							<span class="label">实际退款：</span>
							<!-- <el-input v-model="tableStatistics.realMoney" size="mini" style="font-size:0.16rem;width:1.15rem;"></el-input> -->
							<el-input-number class="refund_alterMoney" v-model="tableStatistics.realMoney" :precision="2" style="width: 1.15rem;"
							:min="0" :max="tableStatistics.totalMoney" :controls="false"></el-input-number>
							<el-button @click="confirmAlter" style="font-size:0.16rem;">确定</el-button>
						</div>
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="otherinfo">其他信息</span>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退款订单号：</span>
						<span class="value">{{otherInfo.orderNo}}</span>
					</div>
				</div>
				<!-- <div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">第三方订单号：</span>
						<span class="value">{{otherInfo.otherOrderNo}}</span>
					</div>
				</div> -->
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">状态：</span>
						<span class="value">{{otherInfo.statu}}</span>
					</div>
				</div>
				<!-- <div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">支付方式：</span>
						<span class="value">{{otherInfo.payModeName}}</span>
					</div>
				</div> -->
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">跟单人：</span>
						<span class="value">{{otherInfo.executeUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费操作：</span>
						<span class="value">{{otherInfo.createUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费方式：</span>
						<span class="value">{{otherInfo.refundModeName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费原因：</span>
						<span class="value">{{otherInfo.mark}}</span>
					</div>
				</div>
			</div>
			<!-- 餐费订单 -->
			<div v-show="ordertype==4">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</div>
					<div class="txtbox">
						<span class="label">退款时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">收款人：</span>
						<span class="value">{{studentInfo.payeeName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">收款人电话：</span>
						<span class="value">{{studentInfo.payeeTel}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">退款详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="180"
								prop="p_orderName"
								label="课程/商品/订单/餐费">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)"
										>￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_payModeName"
								label="支付方式">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)"
										>￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="累计请假">
									<template slot-scope="scope">
										<span>{{scope.row.p_leaveTotalDays}}</span>
										<br>
										<el-button v-if="scope.row.p_leaveTotalDays!=0" type="text" style="font-size:0.16rem;"
											@click="showMealsAttendList(scope.row)">用餐记录</el-button>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="应退费金额">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldRefundMoney===0||(scope.row.p_shouldRefundMoney)"
										>￥{{scope.row.p_shouldRefundMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="实际退费">
									<template slot-scope="scope">
										<span v-show="scope.row.p_realRefundMoney===0||(scope.row.p_realRefundMoney)"
										>￥{{scope.row.p_realRefundMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_orderState"
								label="状态">
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">总计：</span>
							<span class="value" style="width: 1.73rem;">￥{{tableStatistics.totalMoney}}</span>
						</div>
						<div class="item actual" v-show="!showAlterMoney" style="margin-top:0.1rem;">
							<span class="label">实际退款：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
							<i class="el-icon-edit editBtn" @click="alterMoney"></i>
						</div>
						<div class="item actual" v-show="showAlterMoney" style="margin-top:0.1rem;">
							<span class="label">实际退款：</span>
							<!-- <el-input v-model="tableStatistics.realMoney" size="mini" style="font-size:0.16rem;width:1.15rem;"></el-input> -->
							<el-input-number class="refund_alterMoney" v-model="tableStatistics.realMoney" :precision="2" style="width: 1.15rem;"
							:min="0" :max="tableStatistics.totalMoney" :controls="false"></el-input-number>
							<el-button @click="confirmAlter" style="font-size:0.16rem;">确定</el-button>
						</div>
						<!-- <div class="item deposit" v-if="false">
							<span class="label">优惠：</span>
							<span class="value">￥0</span>
						</div> -->
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<div class="row">
					<span class="otherinfo">其他信息</span>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退款订单号：</span>
						<span class="value">{{otherInfo.orderNo}}</span>
					</div>
				</div>
				<!-- <div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">第三方订单号：</span>
						<span class="value">{{otherInfo.otherOrderNo}}</span>
					</div>
				</div> -->
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">状态：</span>
						<span class="value">{{otherInfo.statu}}</span>
					</div>
				</div>
				<!-- <div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">支付方式：</span>
						<span class="value">{{otherInfo.payModeName}}</span>
					</div>
				</div> -->
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">跟单人：</span>
						<span class="value">{{otherInfo.executeUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费操作：</span>
						<span class="value">{{otherInfo.createUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费方式：</span>
						<span class="value">{{otherInfo.refundModeName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费原因：</span>
						<span class="value">{{otherInfo.mark}}</span>
					</div>
				</div>
			</div>
			<!-- 转班订单 -->
			<div v-show="ordertype==5">
				<div class="row">
					<span class="title">学员信息</span>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">姓名：</span>
						<span class="value">{{studentInfo.studentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系人：</span>
						<span class="value">{{studentInfo.parentName}}</span>
					</div>
					<div class="txtbox">
						<span class="label">联系电话：</span>
						<span class="value">{{studentInfo.phoneNumber}}</span>
					</div>
					<div class="txtbox">
						<span class="label">下单时间：</span>
						<span class="value">{{studentInfo.createTime}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox">
						<span class="label">合同号：</span>
						<span class="value">{{studentInfo.orderNo}}</span>
					</div>
				</div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="title">退费详情</span>
				</div>
				<div class="row table">
					<div class="table" style="width:100%;">
						<template >
							<el-table
								:data="tableData"
								stripe
								style="width: 100%;font-size:0.16rem;"
								>
								<el-table-column
								align="center"
								width="50"
								label="">
									<template slot-scope="scope">
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-if="scope.row.p_ordertype==1">课</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==2">商</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==3">订</div>
										<div class="orderTypeSymbol" :type="scope.row.p_ordertype" v-else-if="scope.row.p_ordertype==4">餐</div>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								width="150"
								prop="p_orderName"
								label="课程/商品">
								</el-table-column>
								<el-table-column
								align="center"
								label="单价">
									<template slot-scope="scope">
										<span v-show="scope.row.p_unitPrice===0||(scope.row.p_unitPrice)"
										>￥{{scope.row.p_unitPrice}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_unit"
								label="单位">
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_buyNumber"
								label="购买数量">
								</el-table-column>
								<el-table-column
								align="center"
								label="合计">
									<template slot-scope="scope">
										<span v-show="scope.row.p_totalMoney===0||(scope.row.p_totalMoney)"
										>￥{{scope.row.p_totalMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="原班剩余费用">
									<template slot-scope="scope">
										<span v-show="scope.row.p_preClassMoney===0||(scope.row.p_preClassMoney)"
										>￥{{scope.row.p_preClassMoney}}</span>
										<br>
										<el-button type="text" style="font-size:0.16rem;"
											@click="showChangeDetials(scope.row)">转班详情</el-button>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								label="转班支付">
									<template slot-scope="scope">
										<span v-show="scope.row.p_changeClassMoney===0||(scope.row.p_changeClassMoney)"
										>￥{{scope.row.p_changeClassMoney}}</span>
									</template>
								</el-table-column>
								<!-- <el-table-column
								align="center"
								label="优惠金额">
									<template slot-scope="scope">
										<span v-show="scope.row.p_discountMoney===0||(scope.row.p_discountMoney)"
										>￥{{scope.row.p_discountMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_discountName"
								label="优惠名称">
								</el-table-column> -->
								<!-- <el-table-column
								align="center"
								label="订金扣减">
									<template slot-scope="scope">
										<span v-show="scope.row.p_depositDiscountMoney===0||(scope.row.p_depositDiscountMoney)"
										>￥{{scope.row.p_depositDiscountMoney}}</span>
									</template>
								</el-table-column> -->
								<el-table-column
								align="center"
								label="应退费">
									<template slot-scope="scope">
										<span v-show="scope.row.p_shouldPayMoney===0||(scope.row.p_shouldPayMoney)"
										>￥{{scope.row.p_shouldPayMoney}}</span>
									</template>
								</el-table-column>
								<el-table-column
								align="center"
								prop="p_orderState"
								label="状态">
								</el-table-column>
							</el-table>
						</template>
					</div>
					<div class="statisticsBox" style="margin-top: 0.1rem;">
						<div class="item primary">
							<span class="label">总计：</span>
							<span class="value">￥{{tableStatistics.totalMoney}}</span>
						</div>
						<div class="item actual">
							<span class="label">实际退费：</span>
							<span class="value">￥{{tableStatistics.realMoney}}</span>
						</div>
						<!-- <div class="item deposit">
							<span class="label">订金扣减：</span>
							<span class="value">￥{{tableStatistics.earnestMoney}}</span>
						</div> -->
					</div>
				</div>
				<div class="row line" style="margin-top: 0.3rem;"></div>
				<div class="row" style="margin-top: 0.16rem;">
					<span class="otherinfo">其他信息</span>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">订单号：</span>
						<span class="value">{{otherInfo.orderNo}}</span>
					</div>
				</div>
				<!-- <div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">第三方订单号：</span>
						<span class="value">{{otherInfo.otherOrderNo}}</span>
					</div>
				</div> -->
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">状态：</span>
						<span class="value">{{otherInfo.statu}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">退费方式：</span>
						<span class="value">{{otherInfo.payModeName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">跟单人：</span>
						<span class="value">{{otherInfo.executeUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">收款人：</span>
						<span class="value">{{otherInfo.createUserName}}</span>
					</div>
				</div>
				<div class="row">
					<div class="txtbox alignCenterBox" style="width:100%;">
						<span class="label">备注：</span>
						<span class="value">{{otherInfo.mark}}</span>
					</div>
				</div>
				
			</div>
			<!-- 审核按钮 -->
			<div class="row" style="margin-top:0.3rem;">
				<div class="row" style="justify-content:center;">
					<el-button class="resetElement" type="primary" style="width:1.5rem;" @click="cancel">取消</el-button>
					<el-button class="resetElement" type="primary" style="width:1.5rem;" @click="cancelRefundPopup.visible = true">驳回</el-button>
					<el-button class="resetElement" type="primary" style="width:1.5rem;" @click="checkRefundOrders">审核通过</el-button>
				</div>
			</div>
		</div>
		<!-- 退款驳回弹窗 -->
		<div class="cancelRefundPopup" v-show="cancelRefundPopup.visible">
			<div class="incontent">
				<span class="title">请输入驳回原因：</span>
				<el-input
					type="textarea"
					resize="none"
					:rows="4"
					placeholder="请输入原因"
					style="margin: 0.1rem 0;"
					v-model="cancelRefundPopup.reason">
				</el-input>
				<span class="footer">
					<el-button class="resetElement" type="primary" style="width:1.2rem;" @click="cancelRefundPopup.visible = false">取 消</el-button>
					<el-button class="resetElement" type="primary" style="width:1.2rem;" @click="cancelRefundOrders">提交原因</el-button>
				</span>
			</div>
		</div>

		<!--学员考勤-->
		<attendance ref="attendance_meals"></attendance>
		<!-- 转班详情 -->
		<el-dialog class="changeclassDetials" title="转班详情"
			style="background: rgba(0,0,0,0.5);"
			:visible.sync="changeClassDetialsVisible"
			:close-on-click-modal="false"
			:modal="false">
			<ordersChangeClassDetials ref="ordersChangeClassDetials"></ordersChangeClassDetials>
		</el-dialog>
	</div>
</template>

<script>
	let vm;
	import attendance from "./attendance"; //学员考勤
	import ordersChangeClassDetials from "./orders_changeClassDetials"; //转班详情
	import fNumber from "@/js/utils/floatnumber.js"
	export default{
		components:{attendance,ordersChangeClassDetials},
		data(){
			return {
				orderRefundId:'',
				/**类型 */
				ordertype:1,
				/**学员信息 */
				studentInfo:{
					studentName:'',
					parentName:'',
					phoneNumber:'',
					createTime:'',
					orderNo:'',
				},
				/**表格数据 */
				tableData:[],
				tableStatistics:{
					totalMoney:0,
					realMoney:0
				},
				/**其他信息 */
				otherInfo:{
					orderNo:'',
					otherOrderNo:'',
					statu:'',
					payModeName:'',
					executeUserName:'',
					createUserName:'',
					mark:''
				},
				cancelRefundPopup:{
					visible:false,
					reason:''
				},
				showAlterMoney:false,
				changeClassDetialsVisible:false,

				//转班
				/**转班支付 */
				changeClass_curClassMoney:0,
				/**原班剩余 */
				changeClass_preClassMoney:0,
				/**应支付/应退费 */
				changeClass_classlabel:'应支付',
				changeClass_shouldPayRefund:0,
			}
		},
		methods:{
			/**初始化 */
			updateByData(data){
				this.orderRefundId=data.orderRefundId;
				this.ordertype=data.ordertype;
				this.studentInfo=data.studentInfo;
				this.tableData=data.tableData;
				this.tableStatistics=data.tableStatistics;
				this.otherInfo=data.otherInfo;
				this.cancelRefundPopup.visible=false;
				this.showAlterMoney=false;

				//转班重新获取数据
				if(this.ordertype==5){
					this.getChangeClassInfo();
				}
			},
			cancel(){
				this.$emit('hideMe');
			},
			success(){
				this.$emit('success');
			},
			/**退费审核 */
			checkRefundOrders(){
				let self=this;
				api.setRefundAuditOrder({
					orderRefundId:this.orderRefundId,
					orderRefundState:1,
					auditType:1,
					changeMoney:this.tableStatistics.realMoney,
					_wait:'',
				})
				.then(function(d){
					// console.log(d);
					if(d.resultCode==2000){
						self.$message({
							message: '操作成功！',
							type: 'success'
						});
						// self.cancel();
						self.success();
					}
					else{
						self.$message({
							message: d.message||'操作失败！',
							type: 'warning'
						});
					}
					
				});
			},
			/**驳回退费 */
			cancelRefundOrders(){
				let self=this;
				api.setRefundAuditOrder({
					orderRefundId:this.orderRefundId,
					orderRefundState:2,
					sRemark:this.cancelRefundPopup.reason,
					auditType:1,
					_wait:'',
				})
				.then(function(d){
					// console.log(d);
					if(d.resultCode==2000){
						self.$message({
							message: '操作成功！',
							type: 'success'
						});
						// self.cancel();
						self.success();
					}
					else{
						self.$message({
							message: d.message||'操作失败！',
							type: 'warning'
						});
					}
					
				});
			},
			alterMoney(){
				this.showAlterMoney=true;
			},
			confirmAlter(){
				let num=Number(this.tableStatistics.realMoney);
				// debugger
				if(typeof num != 'number'||isNaN(num)){
					this.$message({
						message: '请输入数值！',
						type: 'warning'
					});
					return;
				}
				if(num<0){
					this.$message({
						message: '退费金额不能小于0！',
						type: 'warning'
					});
					return;
				}
				if(num>this.tableStatistics.totalMoney){
					this.$message({
						message: '请输入不大于'+this.tableStatistics.totalMoney+'的值！',
						type: 'warning'
					});
					return;
				}
				this.showAlterMoney=false;
			},
			/**餐费-考勤列表 */
			showMealsAttendList(li){
				// this.$refs.attendance_meals.init(this.studentInfo.studentId,
				// this.studentInfo.studentName,1);

				let param={
					mealsType:li.mealsType,
					mealsId:li.mealsId, 
					studentId:this.studentInfo.studentId,
					studentName:this.studentInfo.studentName,
					startTime:li.startTimeSettlement,
					endTime:li.endTimeSettlement
				};
				vm.$refs.attendance_meals.init(param);
			},
			/**转班--获取转班信息 */
			getChangeClassInfo(){
				let row=this.tableData[0];
				let orderCourseId=row.p_orderSignupCourseId||row.p_orderRefundCourseId;
				api.getExchangeOrderCourseInfo2({id:orderCourseId}).then(function(d){
					if(d.resultCode==2000){
						// debugger
						let classInfo=d.info||{};
						classInfo.coursePackage=classInfo.coursePackage||{};
						//单价
						let unitPriceNumber=Math.ceil(
								(classInfo.coursePackage.totalMoney * 100) /
								(classInfo.coursePackage.courseHour||1)
							) / 100;
						if(classInfo.coursePackage.chargeMode == 3){
							unitPriceNumber=classInfo.coursePackage.totalMoney
								// Math.ceil(
								// 	(classInfo.coursePackage.totalMoney * 100) /
								// 	(classInfo.totalCourseHour||1)
								// ) / 100;
						}
						//原班合计
						vm.tableData[0].p_totalMoney=fNumber.multiply(classInfo.courseBuyNum,unitPriceNumber);
						//剩余费用
						let surplusMoney=fNumber.parseNumber((classInfo.courseBuyNum-classInfo.courseUseHour)*unitPriceNumber);
						vm.changeClass_preClassMoney=surplusMoney;
						vm.getShouldPayRefundMoney();
					}
					else{
						vm.changeClass_preClassMoney=0;
					}
				});
				//新班信息
				api.getClassInfoByIdChange2({ studentCourseId: orderCourseId }).then(function(d) {
					if (d.resultCode == 2000) {
						let classInfo = d.info;
						if (!classInfo.coursePackage) classInfo.coursePackage = {};
						//单价
						let unitPriceNumber=Math.ceil(
								(classInfo.coursePackage.totalMoney * 100) /
								(classInfo.coursePackage.courseHour||1)
							) / 100;
						if(classInfo.coursePackage.chargeMode == 3){
							unitPriceNumber=classInfo.coursePackage.totalMoney
								// Math.ceil(
								// 	(classInfo.coursePackage.totalMoney * 100) /
								// 	(classInfo.totalCourseHour||1)
								// ) / 100;
						}
						
						vm.changeClass_curClassMoney=fNumber.multiply(classInfo.courseHour,unitPriceNumber);
						vm.getShouldPayRefundMoney();
					} else {
						vm.changeClass_curClassMoney=0;
					}
				});
			},
			/**转班--应退费 */
			getShouldPayRefundMoney(){
				//原班剩余
				this.tableData[0].p_preClassMoney=vm.changeClass_preClassMoney;
				//转班支付
				this.tableData[0].p_changeClassMoney=vm.changeClass_curClassMoney;
				//应退费/应支付
				this.tableData[0].p_shouldPayMoney = Math.abs(fNumber.subtract(vm.changeClass_curClassMoney,vm.changeClass_preClassMoney));
			},
			/**转班--详情弹窗 */
			showChangeDetials(row){
				this.changeClassDetialsVisible=true;
				this.$nextTick(d=>{
					vm.$refs['ordersChangeClassDetials'].updateByData({
						time:this.studentInfo.createTime,
						money:-vm.tableStatistics.realMoney,
						operater:this.otherInfo.createUserName,
						classId:row.p_classId,
						orderCourseId:row.p_orderSignupCourseId||row.p_orderRefundCourseId,
						buyNumber:row.p_buyNumber,
						moneyType:2,//1-收费；2-退费
					});
				});
			}
		},
		mounted(){
		},
		computed:{
			
		},
		watch:{

		},
		created : function() {
			vm=this;
		}
	}
</script>

<style lang="scss">
	.orders_refund_check{
		padding: 0 0.04rem 0.2rem 0.04rem;
		font-size: 0.16rem;
		// color: #333333;
		.row{
			width: 100%;
			display: flex;
    		margin-top: 0.1rem;
			.title{
				font-size: 0.18rem;
				color: #333333;
				font-weight: bold;
			}
			.otherinfo{
				font-size: 0.18rem;
				color: #333333;
				font-weight: bold;
			}
			.txtbox{
				min-width: 25%;
				.label{

				}
				.value{

				}
			}
			.alignCenterBox{
				.label{
					width: 1.25rem;
					text-align: right;
					display: inline-block;
				}
			}
			.table{
				.el-table__header-wrapper{
					.el-table__header thead{
						color: #666666 !important;
						font-size: 0.16rem !important;
					}
				}
				.el-table__body-wrapper{
					.el-table__row{
						.cell{
							white-space: pre-line !important;
							font-size: 0.16rem !important;
						}
					}
					.cloumn-type{
						.type{
							display: block;
							height: 0.2rem;
							line-height: 0.2rem;
							font-size: 0.12rem;
							background-color: #3885F8;
							color: white;
							border-radius: 0.05rem;
							width: 0.35rem;
							padding: 0 0.05rem;
							text-align: center;
						}
					}
				}
			}
			.statisticsBox{
				width: 100%;
				text-align: right;
				font-size: 0.18rem;
				.primary{
					// font-size: 0.16rem;
				}
				.actual{
					.value{
						font-size: 0.26rem;
    					color: #fc7301;
						font-weight: 600;
						// color: red;
					}
				}
				.deposit{
					// font-size: 0.14rem;
				}
				.item{
					.label{
						display: inline-block;
						width: 0.9rem;
						text-align: right;
					}
					.value{
						display: inline-block;
						min-width: 1.5rem;
						text-align: left;
					}
				}
			}
		}
		.row.line{
			width: 100%;
			height: 1px;
			border-top: 0.005rem solid #6666667d;
		}
		.row.table{
			flex-wrap: wrap;
		}
		.editBtn{
			color: #3885F8;
			cursor: pointer;
		}
		// 滚动条
		.el-table__body-wrapper::-webkit-scrollbar {
			width: 0.05rem;
		}
		.el-table__body-wrapper::-webkit-scrollbar-thumb {
			border-radius: 0.5rem;
			background: #BBBBBB;
		}
		.el-table__body-wrapper::-webkit-scrollbar-track {
			background: #F2F6FC;
		}
		.refund_alterMoney{
			.el-input{
				font-size: 0.16rem !important;
			}
		}
		
	}
	// 驳回弹窗
	.cancelRefundPopup{
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: 3000;
		display: flex;
		justify-content: center;
		align-items: center;
		.incontent{
			width: 5.5rem;
			height: 2.5rem;
			background: #FFFFFF;
			box-shadow: 0 0.01rem 0.03rem rgba(0, 0, 0, 0.3);
			border-radius: 0.1rem;
			padding: 0.2rem 0.3rem;
			.title{
				width: 100%;
				font-size: 0.2rem;
				font-weight: bold;
			}
			.footer{
				display: flex;
    			justify-content: center;
			}
			.el-textarea__inner{
				font-size: 0.18rem;
			}
		}
		
	}
</style>